﻿@page "/basic/catalog/list"

@using HentaiBlazor.Data.Basic;

<PageContainer Title="目录设置">

    <Space Style="margin-bottom: 0.5rem">
        <SpaceItem>
            <Input Prefix="@_filter" Placeholder="关键字" Style="width: 12rem;"
                   @bind-Value="searchKeyword" />
        </SpaceItem>
        <SpaceItem>
            <Button Type="@ButtonType.Primary" @onclick="Search">查询</Button>
            <Button Type="@ButtonType.Primary" OnClick="() => OpenEdit(null)">添加</Button>
        </SpaceItem>
    </Space>

    <Table TItem="BCatalogEntity" DataSource="@BCatalogEntities" Size=@TableSize.Small>
        <ActionColumn Width="260">
            <Space>
                <SpaceItem>
                    <Button Type="@ButtonType.Primary" Danger OnClick="() => OpenRemove(context.Id)">删除</Button>
                    <Button Type="@ButtonType.Primary" OnClick="() => OpenEdit(context.Id)">修改</Button>
                </SpaceItem>
                <SpaceItem>
                    <Button Type="@ButtonType.Primary" OnClick="() => OpenScan(context.Id)">扫描</Button>
                </SpaceItem>
            </Space>
        </ActionColumn>
        <Column Title="用途" @bind-Field="@context.Usage"></Column>
        <Column Title="文件夹路径" @bind-Field="@context.Path"></Column>
        <Column Title="包含子文件夹" @bind-Field="@context.Children"></Column>
        <Column Title="项目数量" @bind-Field="@context.Items"></Column>
        <Column Title="扫描时间" @bind-Field="@context.Refresh"></Column>
        <Column Title="备注" @bind-Field="@context.Note"></Column>
    </Table>

</PageContainer>

@code 
{
    RenderFragment _filter = @<Icon Type="filter" />;
}
